package cn.itcast.scala.course04

/**
  * 抽象类
  * create by zhangtian on 2018/12/29
  */
object AbstractApp {
  def main(args: Array[String]): Unit = {
    val en = new Engineer
    println(en.name)
    println(en.age)

    en.speak
  }

  /**
    * 类的一个或多个方法没有没有完整的实现（只有定义，没有实现）
    */
  abstract class Worker {
    def speak
    val name: String
    val age: Int
  }

  class Engineer extends Worker{
    override def speak: Unit = {
      println("Engineer speaking ...... ")
    }

    override val name: String = "涨势"
    override val age: Int = 21
  }
}
